package com.lyw.home.vm

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.blankj.utilcode.util.LogUtils
import com.lu.library.CommLibInit
import com.lyw.db.DatabaseProvider
import com.lyw.home.Poety
import com.lyw.home.bean.SearchResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext




class SearchVm:ViewModel() {

    private val _searchResult = MutableStateFlow<List<SearchResult>>(mutableListOf())
    val searchResult: StateFlow<List<SearchResult>> = _searchResult.asStateFlow()

    private val _textState = MutableStateFlow<String>("")
    val textState: StateFlow<String> = _textState


    private suspend fun searchKeyWord(keyWord:String)=
        withContext(Dispatchers.IO) {

    }

    fun searchKeyWord(textFlow: Flow<CharSequence?>){

    }
}